1. Field of the Invention
The present invention relates to a performance monitor device, a data collecting method and a program for the device and method. In particular, the present invention relates to a performance monitor device, a data collection method and a program for the data collection method, for collecting data used to evaluate operating conditions of a processor.
2. Description of the Related Art
A performance monitor device is provided for collecting data on an occurrence state of an event occurring in a processor. This performance monitor device is provided with counters each corresponding to each of events. Every time each event occurs, the performance monitor device increments a counter value of the counter corresponding to the event, and stores the counter values in an internal buffer called a trace buffer upon completion of a predetermined interval time.
In this way, each of the counter values obtained for each predetermined interval time is stored in the trace buffer, and thereby the performance monitor device can recognize the occurring states of the events for each interval time.
Alternatively, a method has been proposed in which statistical data on events that may influence performance deterioration of a processor to a large extent, and statistical data on the other events are stored in different memories, respectively (JP-A 2001-142747 (KOKAI)).
In a conventional performance monitor device, the number of counters is reduced by selecting only predetermined specific events in advance among a huge number of events occurring in a processor, and then counting the numbers of occurrences of these predetermined specific events.
Specifically, as shown in FIG. 1, counters associated respectively with predetermined events, for example, three counters C1 to C3 are arranged in a conventional performance monitor device, and the counters count the numbers of occurrences of the events associated with the counters C1 to C3, respectively. With this configuration, if the event associated with the counter C1 occurs, the counter C1 is incremented, if the event associated with the counter C2 occurs, the counter C2 is incremented, and if the event associated with the counter C3 occurs, the counter C3 is incremented.
This counting operation is repeated in every cycle. Upon completion of a predetermined time period (called an interval time INT, below), the counter values of the respective counters are stored in a trace buffer.
To be more precise, suppose that seven cycles are defined as one interval time INT as in FIG. 2, the events associated with the first, second and third counters C1, C2 and C3 (shown in FIG. 1) are called the first, second and third events EV1, EV2 and EV3, respectively. Then, as shown in FIG. 2, consider a case where the second event EV2 occurs in the first and second cycles, where the first and second events EV1 and EV2 occur in the third cycle, where no event occurs in the fourth and fifth cycles, and where the third event EV3 occurs in the sixth and seventh cycles, for example. In this case, when the interval time INT passes, the counter values of the counters C1, C2 and C3 are 1, 3 and 2, respectively.
These counter values are stored in the trace buffer upon completion of one interval time INT. After all the counter values of the counters C1 to C3 are stored, all the counter values of the counters C1 to C3 are reset. Thereafter, the counting operation is restarted for the next interval time INT.
In this way, the counter value of each of the counters C1 to C3 in each interval time is sequentially stored in the trace buffer.
Moreover, the performance monitor device is configured to measure program count (PC) values in each cycle. A PC value measured in any one of cycles (for example, in the last cycle) of one interval time INT is stored in the trace buffer in association with each of the counter values measured for the interval time INT.
FIG. 2 shows an example of data stored in the trace buffer. In this example, the counter values CXT1 (=1), CXT2 (=3) and CXT3 (=2) of the respective counters C1 to C3, and the PC value (0x87) measured in the last cycle of a first interval time INT1 are stored as data for the first interval time INT1. Similarly, the counter values CXT1 (=4), CXT2 (=6) and CXT3 (=1) of the respective counters C1 to C3, and the PC value (0x22) measured in the last cycle of a second interval time INT2 are stored as data for the second interval time INT2. For each of the following continuous interval times, the same kinds of data are sequentially stored.
As described above, in the trace buffer, the number of occurrences of each of particular events for each of the interval times INT1, INT2, . . . , INTn, and the PC value measured in the last cycle of each of the interval times INT1, INT2, . . . , INTn are stored in association with each other in chronological order. Such data is called trace data.
The trace data thus stored in the performance monitor device is used for tuning software.
However, the counter values CXT1 to CXT3 do not exactly show performance characteristics at a time of execution in a program area indicated by the PC value associated with the counter values CXT1 to CXT3. This is because, in such trace data, the numbers of event occurrences in all cycles of a certain interval time INT are stored as the counter values CXT1 to CXT3, while a PC value in any one of cycles of the certain interval time INT is stored as the PC value associated with these counter values. As a result, software tuning with such trace data may result in a failure to achieve an effect on sufficient performance improvement.
A possible countermeasure for solving such a problem is to shorten an interval time INT, and thereby corresponding accuracy of each PC value and counter values can be improved. However, the following problems occur in this case. Firstly, when the interval time INT is short, it is necessary to enlarge a buffer area for storing trace data. Secondly, in a case of a configuration in which trace data is stored in an external memory, trace data requires an external memory area to a large extent, and an increase in frequency of storing the trace data into the external memory lowers the availability of memory bandwidth.